﻿using System;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Payroll.BusinessLogic.EmployeeManagement;
using Payroll.BusinessLogic.Audit;
using Payroll.BusinessLogic.Audit.UsersOnline;
using Payroll.BusinessLogic.Configuration.Settings;
using Payroll.BusinessLogic.Infrastructure;
using Payroll.BusinessLogic.Security;
using Payroll.Common.Utils;
using Payroll.BusinessLogic.Directory;
using Payroll.BusinessLogic;
using Payroll.BusinessLogic.Localization;
using Payroll.BusinessLogic.CustomerManager;
using Payroll.BusinessLogic.Devices;

namespace PayrollHR.Web
{
    public partial class BasePayrollMasterPage : MasterPage
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            SetFavIcon();
        }

        protected void SetFavIcon()
        {
            string favIconPath = HttpContext.Current.Request.PhysicalApplicationPath + "favicon.ico";
            if (File.Exists(favIconPath))
            {
                string favIconUrl = CommonHelper.GetStoreLocation() + "favicon.ico";

                HtmlLink htmlLink1 = new HtmlLink();
                htmlLink1.Attributes["rel"] = "icon";
                htmlLink1.Attributes["href"] = favIconUrl;

                HtmlLink htmlLink2 = new HtmlLink();
                htmlLink2.Attributes["rel"] = "shortcut icon";
                htmlLink2.Attributes["href"] = favIconUrl;

                Page.Header.Controls.Add(htmlLink1);
                Page.Header.Controls.Add(htmlLink2);
            }
        }
        protected string GetLocaleResourceString(string ResourceName)
        {
            Language language = PayrollContext.Current.WorkingLanguage;
            return this.LocalizationManager.GetLocaleResourceString(ResourceName, language.LanguageId);
        }
        #region Services, managers

        public IOnlineUserService OnlineUserService
        {
            get { return IoC.Resolve<IOnlineUserService>(); }
        }
        public ICustomerActivityService CustomerActivityService
        {
            get { return IoC.Resolve<ICustomerActivityService>(); }
        }
        public ILocalizationManager LocalizationManager
        {
            get { return IoC.Resolve<ILocalizationManager>(); }
        }
        public ILogService LogService
        {
            get { return IoC.Resolve<ILogService>(); }
        }
        public ISearchLogService SearchLogService
        {
            get { return IoC.Resolve<ISearchLogService>(); }
        }
        public ISettingManager SettingManager
        {
            get { return IoC.Resolve<ISettingManager>(); }
        }
        public IEmployeeService employeeService
        {
            get { return IoC.Resolve<IEmployeeService>(); }
        }
       
        public IACLService ACLService
        {
            get { return IoC.Resolve<IACLService>(); }
        }
        public IBlacklistService BlacklistService
        {
            get { return IoC.Resolve<IBlacklistService>(); }
        }
        public ICustomerService CustomerService
        {
            get { return IoC.Resolve<ICustomerService>(); }
        }
        public IVoucherService VoucherService
        {
            get { return IoC.Resolve<IVoucherService>(); }
        }
        #endregion
    }
}